﻿using System;
using System.Collections.Generic;
using System.IO;
using Illusion.Elements.Xml;
using Manager;
using UnityEngine;

namespace Studio
{
	// Token: 0x02000504 RID: 1284
	public sealed class Studio : Singleton<Studio>
	{
		// Token: 0x170003CE RID: 974
		// (get) Token: 0x0600208B RID: 8331 RVA: 0x000C9400 File Offset: 0x000C7600
		public TreeNodeCtrl treeNodeCtrl
		{
			get
			{
				return this.m_TreeNodeCtrl;
			}
		}

		// Token: 0x170003CF RID: 975
		// (get) Token: 0x0600208C RID: 8332 RVA: 0x000C9408 File Offset: 0x000C7608
		public RootButtonCtrl rootButtonCtrl
		{
			get
			{
				return this.m_RootButtonCtrl;
			}
		}

		// Token: 0x170003D0 RID: 976
		// (get) Token: 0x0600208D RID: 8333 RVA: 0x000C9410 File Offset: 0x000C7610
		public UI_ColorMenu colorMenu
		{
			get
			{
				return this.m_ColorMenu;
			}
		}

		// Token: 0x170003D1 RID: 977
		// (get) Token: 0x0600208E RID: 8334 RVA: 0x000C9418 File Offset: 0x000C7618
		public CameraControl cameraCtrl
		{
			get
			{
				return this.m_CameraCtrl;
			}
		}

		// Token: 0x170003D2 RID: 978
		// (get) Token: 0x0600208F RID: 8335 RVA: 0x000C9420 File Offset: 0x000C7620
		// (set) Token: 0x06002090 RID: 8336 RVA: 0x000C9428 File Offset: 0x000C7628
		public bool isInputNow { get; set; }

		// Token: 0x170003D3 RID: 979
		// (get) Token: 0x06002091 RID: 8337 RVA: 0x000C9434 File Offset: 0x000C7634
		public SystemButtonCtrl systemButtonCtrl
		{
			get
			{
				return this.m_SystemButtonCtrl;
			}
		}

		// Token: 0x170003D4 RID: 980
		// (get) Token: 0x06002092 RID: 8338 RVA: 0x000C943C File Offset: 0x000C763C
		public BGMCtrl bgmCtrl
		{
			get
			{
				return this.sceneInfo.bgmCtrl;
			}
		}

		// Token: 0x170003D5 RID: 981
		// (get) Token: 0x06002093 RID: 8339 RVA: 0x000C944C File Offset: 0x000C764C
		public ENVCtrl envCtrl
		{
			get
			{
				return this.sceneInfo.envCtrl;
			}
		}

		// Token: 0x170003D6 RID: 982
		// (get) Token: 0x06002094 RID: 8340 RVA: 0x000C945C File Offset: 0x000C765C
		public OutsideSoundCtrl outsideSoundCtrl
		{
			get
			{
				return this.sceneInfo.outsideSoundCtrl;
			}
		}

		// Token: 0x170003D7 RID: 983
		// (get) Token: 0x06002095 RID: 8341 RVA: 0x000C946C File Offset: 0x000C766C
		public CameraLightCtrl cameraLightCtrl
		{
			get
			{
				return this.m_CameraLightCtrl;
			}
		}

		// Token: 0x170003D8 RID: 984
		// (get) Token: 0x06002096 RID: 8342 RVA: 0x000C9474 File Offset: 0x000C7674
		public GameScreenShotAssist gameScreenShotAssist
		{
			get
			{
				return this.m_GameScreenShotAssist;
			}
		}

		// Token: 0x170003D9 RID: 985
		// (get) Token: 0x06002097 RID: 8343 RVA: 0x000C947C File Offset: 0x000C767C
		public ColorPaletteCtrl colorPaletteCtrl
		{
			get
			{
				return this.m_ColorPaletteCtrl;
			}
		}

		// Token: 0x170003DA RID: 986
		// (get) Token: 0x06002098 RID: 8344 RVA: 0x000C9484 File Offset: 0x000C7684
		public GameObject[] prefabFemaleHand
		{
			get
			{
				return this.m_PrefabFemaleHand;
			}
		}

		// Token: 0x170003DB RID: 987
		// (get) Token: 0x06002099 RID: 8345 RVA: 0x000C948C File Offset: 0x000C768C
		public GameObject[] prefabMaleHand
		{
			get
			{
				return this.m_PrefabMaleHand;
			}
		}

		// Token: 0x170003DC RID: 988
		// (get) Token: 0x0600209A RID: 8346 RVA: 0x000C9494 File Offset: 0x000C7694
		// (set) Token: 0x0600209B RID: 8347 RVA: 0x000C949C File Offset: 0x000C769C
		public SceneInfo sceneInfo { get; private set; }

		// Token: 0x170003DD RID: 989
		// (get) Token: 0x0600209C RID: 8348 RVA: 0x000C94A8 File Offset: 0x000C76A8
		// (set) Token: 0x0600209D RID: 8349 RVA: 0x000C94B0 File Offset: 0x000C76B0
		public static OptionSystem optionSystem { get; private set; }

		// Token: 0x170003DE RID: 990
		// (get) Token: 0x0600209E RID: 8350 RVA: 0x000C94B8 File Offset: 0x000C76B8
		// (set) Token: 0x0600209F RID: 8351 RVA: 0x000C94C0 File Offset: 0x000C76C0
		public bool isVRMode { get; private set; }

		// Token: 0x060020A0 RID: 8352 RVA: 0x000C94CC File Offset: 0x000C76CC
		public void AddFemale(string _path)
		{
			OCICharFemale ocicharFemale = AddObjectFemale.Add(_path);
			Singleton<UndoRedoManager>.Instance.Clear();
			if (Studio.optionSystem.autoHide)
			{
				this.rootButtonCtrl.OnClick(-1);
			}
			if (Studio.optionSystem.autoSelect && ocicharFemale != null)
			{
				this.m_TreeNodeCtrl.SelectSingle(ocicharFemale.treeNodeObject);
			}
		}

		// Token: 0x060020A1 RID: 8353 RVA: 0x000C952C File Offset: 0x000C772C
		public void AddMale(string _path)
		{
			OCICharMale ocicharMale = AddObjectMale.Add(_path);
			Singleton<UndoRedoManager>.Instance.Clear();
			if (Studio.optionSystem.autoHide)
			{
				this.rootButtonCtrl.OnClick(-1);
			}
			if (Studio.optionSystem.autoSelect && ocicharMale != null)
			{
				this.m_TreeNodeCtrl.SelectSingle(ocicharMale.treeNodeObject);
			}
		}

		// Token: 0x060020A2 RID: 8354 RVA: 0x000C958C File Offset: 0x000C778C
		public void AddMap(int _no, bool _close = true)
		{
			GameObject exists = Singleton<MapCtr>.Instance.LoadMap(_no);
			this.sceneInfo.map = _no;
			this.sceneInfo.caMap.Reset();
			if (this.onChangeMap != null)
			{
				this.onChangeMap();
			}
			if (this.sceneInfo.map != -1)
			{
			}
			this.m_CameraCtrl.CloerListCollider();
			if (exists)
			{
			}
			if (_close)
			{
				this.rootButtonCtrl.OnClick(-1);
			}
		}

		// Token: 0x060020A3 RID: 8355 RVA: 0x000C9618 File Offset: 0x000C7818
		public void AddItem(int _no)
		{
			OCIItem ociitem = AddObjectItem.Add(_no);
			Singleton<UndoRedoManager>.Instance.Clear();
			if (Studio.optionSystem.autoHide)
			{
				this.rootButtonCtrl.OnClick(-1);
			}
			if (Studio.optionSystem.autoSelect && ociitem != null)
			{
				this.m_TreeNodeCtrl.SelectSingle(ociitem.treeNodeObject);
			}
		}

		// Token: 0x060020A4 RID: 8356 RVA: 0x000C9678 File Offset: 0x000C7878
		public void AddLight(int _no)
		{
			OCILight ocilight = AddObjectLight.Add(_no);
			Singleton<UndoRedoManager>.Instance.Clear();
			if (Studio.optionSystem.autoHide)
			{
				this.rootButtonCtrl.OnClick(-1);
			}
			if (Studio.optionSystem.autoSelect && ocilight != null)
			{
				this.m_TreeNodeCtrl.SelectSingle(ocilight.treeNodeObject);
			}
		}

		// Token: 0x060020A5 RID: 8357 RVA: 0x000C96D8 File Offset: 0x000C78D8
		public void AddFolder()
		{
			OCIFolder ocifolder = AddObjectFolder.Add();
			Singleton<UndoRedoManager>.Instance.Clear();
			if (Studio.optionSystem.autoSelect && ocifolder != null)
			{
				this.m_TreeNodeCtrl.SelectSingle(ocifolder.treeNodeObject);
			}
		}

		// Token: 0x060020A6 RID: 8358 RVA: 0x000C971C File Offset: 0x000C791C
		public void AddSkybox(int _no, bool _close = true)
		{
			Singleton<Sky>.Instance.LoadSky(_no);
			this.sceneInfo.skybox = _no;
			if (_close)
			{
				this.rootButtonCtrl.OnClick(-1);
			}
		}

		// Token: 0x060020A7 RID: 8359 RVA: 0x000C9748 File Offset: 0x000C7948
		public void Duplicate()
		{
			Dictionary<int, ObjectInfo> dictionary = new Dictionary<int, ObjectInfo>();
			Dictionary<int, Studio.DuplicateParentInfo> dictionary2 = new Dictionary<int, Studio.DuplicateParentInfo>();
			TreeNodeObject[] selectNodes = this.treeNodeCtrl.selectNodes;
			for (int i = 0; i < selectNodes.Length; i++)
			{
				ObjectCtrlInfo objectCtrlInfo = null;
				if (this.dicInfo.TryGetValue(selectNodes[i], out objectCtrlInfo))
				{
					objectCtrlInfo.OnSavePreprocessing();
					dictionary.Add(objectCtrlInfo.objectInfo.dicKey, objectCtrlInfo.objectInfo);
					if (objectCtrlInfo.parentInfo != null)
					{
						dictionary2.Add(objectCtrlInfo.objectInfo.dicKey, new Studio.DuplicateParentInfo(objectCtrlInfo.parentInfo, objectCtrlInfo.treeNodeObject.parent));
					}
				}
			}
			if (dictionary.Count == 0)
			{
				return;
			}
			byte[] buffer = null;
			using (MemoryStream memoryStream = new MemoryStream())
			{
				using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
				{
					this.sceneInfo.Save(binaryWriter, dictionary);
					buffer = memoryStream.ToArray();
				}
			}
			using (MemoryStream memoryStream2 = new MemoryStream(buffer))
			{
				using (BinaryReader binaryReader = new BinaryReader(memoryStream2))
				{
					this.sceneInfo.Import(binaryReader, this.sceneInfo.version);
				}
			}
			foreach (KeyValuePair<int, ObjectInfo> keyValuePair in this.sceneInfo.dicImport)
			{
				Studio.DuplicateParentInfo duplicateParentInfo = null;
				if (dictionary2.TryGetValue(this.sceneInfo.dicChangeKey[keyValuePair.Key], out duplicateParentInfo))
				{
					AddObjectAssist.LoadChild(keyValuePair.Value, duplicateParentInfo.info, duplicateParentInfo.node);
				}
				else
				{
					AddObjectAssist.LoadChild(keyValuePair.Value, null, null);
				}
			}
			this.treeNodeCtrl.RefreshHierachy();
		}

		// Token: 0x060020A8 RID: 8360 RVA: 0x000C9980 File Offset: 0x000C7B80
		public void SaveScene()
		{
			foreach (KeyValuePair<int, ObjectCtrlInfo> keyValuePair in this.dicObjectCtrl)
			{
				keyValuePair.Value.OnSavePreprocessing();
			}
			this.sceneInfo.cameraSaveData = this.m_CameraCtrl.Export();
			DateTime now = DateTime.Now;
			string str = string.Format("{0}_{1:00}{2:00}_{3:00}{4:00}_{5:00}_{6:000}.png", new object[]
			{
				now.Year,
				now.Month,
				now.Day,
				now.Hour,
				now.Minute,
				now.Second,
				now.Millisecond
			});
			string path = UserData.Create("studio/scene") + str;
			this.sceneInfo.Save(path);
		}

		// Token: 0x060020A9 RID: 8361 RVA: 0x000C9A98 File Offset: 0x000C7C98
		public bool LoadScene(string _path)
		{
			if (!File.Exists(_path))
			{
				return false;
			}
			this.InitScene(false);
			this.sceneInfo = new SceneInfo(this.m_GameScreenShotAssist);
			if (!this.sceneInfo.Load(_path))
			{
				return false;
			}
			AddObjectAssist.LoadChild(this.sceneInfo.dicObject, null, null);
			ChangeAmount source = this.sceneInfo.caMap.Clone();
			this.AddMap(this.sceneInfo.map, false);
			this.mapList.UpdateInfo();
			this.sceneInfo.caMap.Copy(source, true, true, true);
			Singleton<MapCtrl>.Instance.Reflect();
			this.bgmCtrl.Play(this.bgmCtrl.no);
			this.envCtrl.Play(this.envCtrl.no);
			this.outsideSoundCtrl.Play(this.outsideSoundCtrl.fileName);
			this.m_BackgroundCtrl.Load(this.sceneInfo.background);
			this.m_BackgroundList.UpdateUI();
			Singleton<Sky>.Instance.LoadSky(this.sceneInfo.skybox);
			this.skyList.UpdateInfo();
			this.m_SystemButtonCtrl.UpdateParam();
			this.treeNodeCtrl.RefreshHierachy();
			if (this.sceneInfo.cameraSaveData != null)
			{
				this.m_CameraCtrl.Import(this.sceneInfo.cameraSaveData);
			}
			this.cameraLightCtrl.Reflect();
			this.rootButtonCtrl.OnClick(-1);
			return true;
		}

		// Token: 0x060020AA RID: 8362 RVA: 0x000C9C14 File Offset: 0x000C7E14
		public bool ImportScene(string _path)
		{
			if (!File.Exists(_path))
			{
				return false;
			}
			if (!this.sceneInfo.Import(_path))
			{
				return false;
			}
			AddObjectAssist.LoadChild(this.sceneInfo.dicImport, null, null);
			this.treeNodeCtrl.RefreshHierachy();
			return true;
		}

		// Token: 0x060020AB RID: 8363 RVA: 0x000C9C54 File Offset: 0x000C7E54
		public void InitScene(bool _close = true)
		{
			this.treeNodeCtrl.DeleteAllNode();
			Singleton<GuideObjectManager>.Instance.DeleteAll();
			this.m_RootButtonCtrl.OnClick(-1);
			this.m_RootButtonCtrl.objectCtrlInfo = null;
			foreach (KeyValuePair<TreeNodeObject, ObjectCtrlInfo> keyValuePair in this.dicInfo)
			{
				if (keyValuePair.Value.kind == 0)
				{
					OCIChar ocichar = keyValuePair.Value as OCIChar;
					if (ocichar != null)
					{
						ocichar.StopVoice();
					}
				}
				UnityEngine.Object.Destroy(keyValuePair.Value.guideObject.transformTarget.gameObject);
			}
			//Singleton<Character>.Instance.DeleteCharaAll();
			this.dicInfo.Clear();
			this.dicChangeAmount.Clear();
			this.dicObjectCtrl.Clear();
			Singleton<MapCtr>.Instance.ReleaseMap();
			this.cameraCtrl.CloerListCollider();
			Singleton<Sky>.Instance.ReleaseSky();
			this.bgmCtrl.Stop();
			this.envCtrl.Stop();
			this.outsideSoundCtrl.Stop();
			this.sceneInfo.Init();
			this.m_SystemButtonCtrl.UpdateParam();
			this.cameraCtrl.Reset(0);
			this.cameraLightCtrl.Reflect();
			this.mapList.UpdateInfo();
			if (this.onChangeMap != null)
			{
				this.onChangeMap();
			}
			this.skyList.UpdateInfo();
			this.m_BackgroundCtrl.Load(this.sceneInfo.background);
			this.m_BackgroundList.UpdateUI();
			this.m_WorkspaceCtrl.UpdateUI();
			Singleton<UndoRedoManager>.Instance.Clear();
			if (_close)
			{
				this.rootButtonCtrl.OnClick(-1);
			}
		}

		// Token: 0x060020AC RID: 8364 RVA: 0x000C9E28 File Offset: 0x000C8028
		public void OnDeleteNode(TreeNodeObject _node)
		{
			ObjectCtrlInfo objectCtrlInfo = null;
			if (!this.dicInfo.TryGetValue(_node, out objectCtrlInfo))
			{
				return;
			}
			if (this.onDelete != null)
			{
				this.onDelete(objectCtrlInfo);
			}
			objectCtrlInfo.OnDelete();
			this.dicInfo.Remove(_node);
		}

		// Token: 0x060020AD RID: 8365 RVA: 0x000C9E78 File Offset: 0x000C8078
		public void OnParentage(TreeNodeObject _parent, TreeNodeObject _child)
		{
			if (_parent)
			{
				ObjectCtrlInfo objectCtrlInfo = this.FindLoop(_parent);
				if (objectCtrlInfo == null)
				{
					GlobalData.Debug_LogWarning("应该不可能");
					return;
				}
				objectCtrlInfo.OnAttach(_parent, this.dicInfo[_child]);
			}
			else
			{
				this.dicInfo[_child].OnDetach();
			}
		}

		// Token: 0x060020AE RID: 8366 RVA: 0x000C9ED4 File Offset: 0x000C80D4
		public void ResetOption()
		{
			if (this.xmlCtrl != null)
			{
				this.xmlCtrl.Init();
			}
		}

		// Token: 0x060020AF RID: 8367 RVA: 0x000C9EEC File Offset: 0x000C80EC
		public void LoadOption()
		{
			if (this.xmlCtrl != null)
			{
				this.xmlCtrl.Read();
			}
		}

		// Token: 0x060020B0 RID: 8368 RVA: 0x000C9F04 File Offset: 0x000C8104
		public void SaveOption()
		{
			if (this.xmlCtrl != null)
			{
				this.xmlCtrl.Write();
			}
		}

		// Token: 0x060020B1 RID: 8369 RVA: 0x000C9F1C File Offset: 0x000C811C
		public void ChangeVRMode()
		{
			this.isVRMode = !this.isVRMode;
			this.m_CameraCtrl.active = !this.isVRMode;
			Singleton<StudioVR>.Instance.active = this.isVRMode;
		}

		// Token: 0x060020B2 RID: 8370 RVA: 0x000C9F54 File Offset: 0x000C8154
		public static void AddInfo(ObjectInfo _info, ObjectCtrlInfo _ctrlInfo)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			if (_info == null || _ctrlInfo == null)
			{
				return;
			}
			Singleton<Studio>.Instance.sceneInfo.dicObject.Add(_info.dicKey, _info);
			Singleton<Studio>.Instance.dicObjectCtrl[_info.dicKey] = _ctrlInfo;
		}

		// Token: 0x060020B3 RID: 8371 RVA: 0x000C9FAC File Offset: 0x000C81AC
		public static void DeleteInfo(ObjectInfo _info, bool _delKey = true)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			if (_info == null)
			{
				return;
			}
			if (Singleton<Studio>.Instance.sceneInfo.dicObject.ContainsKey(_info.dicKey))
			{
				Singleton<Studio>.Instance.sceneInfo.dicObject.Remove(_info.dicKey);
			}
			if (_delKey)
			{
				Singleton<Studio>.Instance.dicObjectCtrl.Remove(_info.dicKey);
				_info.DeleteKey();
			}
		}

		// Token: 0x060020B4 RID: 8372 RVA: 0x000CA028 File Offset: 0x000C8228
		public static ObjectInfo GetInfo(int _key)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return null;
			}
			ObjectInfo objectInfo = null;
			return (!Singleton<Studio>.Instance.sceneInfo.dicObject.TryGetValue(_key, out objectInfo)) ? null : objectInfo;
		}

		// Token: 0x060020B5 RID: 8373 RVA: 0x000CA068 File Offset: 0x000C8268
		public static void AddObjectCtrlInfo(ObjectCtrlInfo _ctrlInfo)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			if (_ctrlInfo == null)
			{
				return;
			}
			Singleton<Studio>.Instance.dicObjectCtrl[_ctrlInfo.objectInfo.dicKey] = _ctrlInfo;
		}

		// Token: 0x060020B6 RID: 8374 RVA: 0x000CA098 File Offset: 0x000C8298
		public static ObjectCtrlInfo GetCtrlInfo(int _key)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return null;
			}
			ObjectCtrlInfo objectCtrlInfo = null;
			return (!Singleton<Studio>.Instance.dicObjectCtrl.TryGetValue(_key, out objectCtrlInfo)) ? null : objectCtrlInfo;
		}

		// Token: 0x060020B7 RID: 8375 RVA: 0x000CA0D4 File Offset: 0x000C82D4
		public static TreeNodeObject AddNode(string _name, TreeNodeObject _parent = null)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return null;
			}
			return Singleton<Studio>.Instance.treeNodeCtrl.AddNode(_name, _parent);
		}

		// Token: 0x060020B8 RID: 8376 RVA: 0x000CA0F4 File Offset: 0x000C82F4
		public static void DeleteNode(TreeNodeObject _node)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			Singleton<Studio>.Instance.treeNodeCtrl.DeleteNode(_node);
		}

		// Token: 0x060020B9 RID: 8377 RVA: 0x000CA114 File Offset: 0x000C8314
		public static void AddCtrlInfo(ObjectCtrlInfo _info)
		{
			if (_info == null)
			{
				return;
			}
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			Singleton<Studio>.Instance.dicInfo.Add(_info.treeNodeObject, _info);
		}

		// Token: 0x060020BA RID: 8378 RVA: 0x000CA140 File Offset: 0x000C8340
		public static ObjectCtrlInfo GetCtrlInfo(TreeNodeObject _node)
		{
			if (_node == null)
			{
				return null;
			}
			if (!Singleton<Studio>.IsInstance())
			{
				return null;
			}
			ObjectCtrlInfo objectCtrlInfo = null;
			return (!Singleton<Studio>.Instance.dicInfo.TryGetValue(_node, out objectCtrlInfo)) ? null : objectCtrlInfo;
		}

		// Token: 0x060020BB RID: 8379 RVA: 0x000CA188 File Offset: 0x000C8388
		public static int GetNewIndex()
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return -1;
			}
			return Singleton<Studio>.Instance.sceneInfo.GetNewIndex();
		}

		// Token: 0x060020BC RID: 8380 RVA: 0x000CA1A8 File Offset: 0x000C83A8
		public static void SetNewIndex(int _index)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			Singleton<Studio>.Instance.sceneInfo.SetNewIndex(_index);
		}

		// Token: 0x060020BD RID: 8381 RVA: 0x000CA1C8 File Offset: 0x000C83C8
		public static void DeleteIndex(int _index)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			Singleton<Studio>.Instance.sceneInfo.DeleteIndex(_index);
			Studio.DeleteChangeAmount(_index);
		}

		// Token: 0x060020BE RID: 8382 RVA: 0x000CA1EC File Offset: 0x000C83EC
		public static void AddChangeAmount(int _key, ChangeAmount _ca)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			try
			{
				Singleton<Studio>.Instance.dicChangeAmount.Add(_key, _ca);
			}
			catch (Exception)
			{
				GlobalData.Debug_Log(_key);
			}
		}

		// Token: 0x060020BF RID: 8383 RVA: 0x000CA23C File Offset: 0x000C843C
		public static void DeleteChangeAmount(int _key)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return;
			}
			Singleton<Studio>.Instance.dicChangeAmount.Remove(_key);
		}

		// Token: 0x060020C0 RID: 8384 RVA: 0x000CA25C File Offset: 0x000C845C
		public static ChangeAmount GetChangeAmount(int _key)
		{
			if (!Singleton<Studio>.IsInstance())
			{
				return null;
			}
			ChangeAmount changeAmount = null;
			return (!Singleton<Studio>.Instance.dicChangeAmount.TryGetValue(_key, out changeAmount)) ? null : changeAmount;
		}

		// Token: 0x060020C1 RID: 8385 RVA: 0x000CA298 File Offset: 0x000C8498
		private ObjectCtrlInfo FindLoop(TreeNodeObject _node)
		{
			if (_node == null)
			{
				return null;
			}
			ObjectCtrlInfo result = null;
			if (this.dicInfo.TryGetValue(_node, out result))
			{
				return result;
			}
			return this.FindLoop(_node.parent);
		}

		// Token: 0x060020C2 RID: 8386 RVA: 0x000CA2D8 File Offset: 0x000C84D8
		protected override void Awake()
		{
			if (!base.CheckInstance())
			{
				return;
			}
			UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
			base.gameObject.AddComponent<Sky>();
			Studio.optionSystem = new OptionSystem("Option");
			List<Data> list = new List<Data>
			{
				Studio.optionSystem
			};
			this.xmlCtrl = new Control("studio", "option.xml", "Option", list.ToArray());
			this.LoadOption();
			if (this.workInfo == null)
			{
				this.workInfo = new WorkInfo();
			}
			this.workInfo.Load();
			this.sceneInfo = new SceneInfo(this.m_GameScreenShotAssist);
			this.m_ColorMenu.InitColorMenu();
			this.m_SystemButtonCtrl.Init();
			TreeNodeCtrl treeNodeCtrl = this.treeNodeCtrl;
			treeNodeCtrl.onDelete = (Action<TreeNodeObject>)Delegate.Combine(treeNodeCtrl.onDelete, new Action<TreeNodeObject>(this.OnDeleteNode));
			TreeNodeCtrl treeNodeCtrl2 = this.treeNodeCtrl;
			treeNodeCtrl2.onParentage = (Action<TreeNodeObject, TreeNodeObject>)Delegate.Combine(treeNodeCtrl2.onParentage, new Action<TreeNodeObject, TreeNodeObject>(this.OnParentage));
			this.m_CameraLightCtrl.Init();
		}

		// Token: 0x060020C3 RID: 8387 RVA: 0x000CA3F4 File Offset: 0x000C85F4
		private void OnApplicationQuit()
		{
			this.SaveOption();
			this.workInfo.Save();
		}

		// Token: 0x04002240 RID: 8768
		public const string savePath = "studio/scene";

		// Token: 0x04002241 RID: 8769
		[SerializeField]
		private TreeNodeCtrl m_TreeNodeCtrl;

		// Token: 0x04002242 RID: 8770
		[SerializeField]
		private RootButtonCtrl m_RootButtonCtrl;

		// Token: 0x04002243 RID: 8771
		[SerializeField]
		private UI_ColorMenu m_ColorMenu;

		// Token: 0x04002244 RID: 8772
		[SerializeField]
		private CameraControl m_CameraCtrl;

		// Token: 0x04002246 RID: 8774
		[SerializeField]
		private SystemButtonCtrl m_SystemButtonCtrl;

		// Token: 0x04002247 RID: 8775
		[SerializeField]
		private CameraLightCtrl m_CameraLightCtrl;

		// Token: 0x04002248 RID: 8776
		[SerializeField]
		private GameScreenShotAssist m_GameScreenShotAssist;

		// Token: 0x04002249 RID: 8777
		[SerializeField]
		private MapList mapList;

		// Token: 0x0400224A RID: 8778
		[SerializeField]
		private SkyList skyList;

		// Token: 0x0400224B RID: 8779
		[SerializeField]
		private ColorPaletteCtrl m_ColorPaletteCtrl;

		// Token: 0x0400224C RID: 8780
		[SerializeField]
		private WorkspaceCtrl m_WorkspaceCtrl;

		// Token: 0x0400224D RID: 8781
		[SerializeField]
		private BackgroundCtrl m_BackgroundCtrl;

		// Token: 0x0400224E RID: 8782
		[SerializeField]
		private BackgroundList m_BackgroundList;

		// Token: 0x0400224F RID: 8783
		[SerializeField]
		private GameObject[] m_PrefabFemaleHand;

		// Token: 0x04002250 RID: 8784
		[SerializeField]
		private GameObject[] m_PrefabMaleHand;

		// Token: 0x04002251 RID: 8785
		public GameObject prefabLookAt;

		// Token: 0x04002253 RID: 8787
		public Dictionary<TreeNodeObject, ObjectCtrlInfo> dicInfo = new Dictionary<TreeNodeObject, ObjectCtrlInfo>();

		// Token: 0x04002254 RID: 8788
		public Dictionary<int, ObjectCtrlInfo> dicObjectCtrl = new Dictionary<int, ObjectCtrlInfo>();

		// Token: 0x04002255 RID: 8789
		public Dictionary<int, ChangeAmount> dicChangeAmount = new Dictionary<int, ChangeAmount>();

		// Token: 0x04002256 RID: 8790
		private const string UserPath = "studio";

		// Token: 0x04002257 RID: 8791
		private const string FileName = "option.xml";

		// Token: 0x04002258 RID: 8792
		private const string RootName = "Option";

		// Token: 0x0400225A RID: 8794
		private Control xmlCtrl;

		// Token: 0x0400225C RID: 8796
		public Action<ObjectCtrlInfo> onDelete;

		// Token: 0x0400225D RID: 8797
		public Action onChangeMap;

		// Token: 0x0400225E RID: 8798
		public WorkInfo workInfo = new WorkInfo();

		// Token: 0x02000505 RID: 1285
		private class DuplicateParentInfo
		{
			// Token: 0x060020C4 RID: 8388 RVA: 0x000CA408 File Offset: 0x000C8608
			public DuplicateParentInfo(ObjectCtrlInfo _info, TreeNodeObject _node)
			{
				this.info = _info;
				this.node = _node;
			}

			// Token: 0x0400225F RID: 8799
			public ObjectCtrlInfo info;

			// Token: 0x04002260 RID: 8800
			public TreeNodeObject node;
		}
	}
}
